package TI;

import java.util.List;

import Exceptions.ProductSalesPriceNeverSetException;
import Magnitudes.Money;
import Magnitudes.Percentage;
import Magnitudes.Pesos;
import Products.Presentation;

public class ProductOffer extends Offer {

	private List<Presentation> presentations;
	
	public ProductOffer(List<Presentation> presentations, Percentage discount){
		
		this.presentations = presentations;
		this.discount = discount;
	}

	@Override
	public Money getPrice() throws ProductSalesPriceNeverSetException {
		Pesos acum = new Pesos(0);
		for (Presentation current: this.presentations){
			acum = acum.add(current.getUnitSalesPrice());
		}
		return acum.subPercentage(this.discount);
	}
}
